<?php

require '../../config.php';
$_codigo = $_REQUEST['id'];
$_query="SELECT clientesventas.tipo, clientesventas.nombre
		  FROM hossbd.clientesventas clientesventas
		  WHERE clientesventas.idclientesventas =  '".$_codigo."'";
/* echo $_query;
echo "<br>"; */
$result = mysql_query($_query,$conexion);  
 
if(mysql_num_rows($result)>0)
{  
			$data = array();
			while ($row = mysql_fetch_assoc($result))
			 {
			    $data[] = $row['tipo'];
    			$data[] =_convert($row['nombre']);
    			/* echo $row['tipo'];
    			echo "<br>";
    			echo $row['nombre']; */
			}
			echo json_encode($data);		
}
else 
{
	echo("0");
}
mysql_close();
function _convert($content) {
	if(!mb_check_encoding($content, 'UTF-8')
	OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {

		$content = mb_convert_encoding($content, 'UTF-8');

		if (mb_check_encoding($content, 'UTF-8')) {
			// log('Converted to UTF-8');
		} else {
			// log('Could not converted to UTF-8');
		}
	}
	return $content;
}

?> 